package dataMapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import dataEntity.LeadingCausesOfDeath;

public class LeadingCausesOfDeathMapper {
	public static  Map<String,Map<String,LeadingCausesOfDeath>> process(BufferedReader br){
		Map<String,Map<String,LeadingCausesOfDeath>> map = new HashMap<String,Map<String,LeadingCausesOfDeath>> ();
		try {
			br.readLine();
			while(br.ready()){
				LeadingCausesOfDeath object = buildObject(br.readLine());

				Map<String,LeadingCausesOfDeath> stateMap = map.get(object.getCHSI_State_Abbr());
				if(stateMap == null) stateMap = new HashMap<String,LeadingCausesOfDeath>();
				stateMap.put(object.getCHSI_County_Name(), object);
				map.put(object.getCHSI_State_Abbr(), stateMap);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return map;
	}
	
	public static  LeadingCausesOfDeath buildObject(String inLine){
		String[] line = inLine.split(",");
		LeadingCausesOfDeath object = new LeadingCausesOfDeath();

		object.setState_FIPS_Code(line[0]);
		object.setCounty_FIPS_Code(line[1]);
		object.setCHSI_County_Name(line[2]);
		object.setCHSI_State_Name(line[3]);
		object.setCHSI_State_Abbr(line[4]);
		object.setStrata_ID_Number(line[5]);
		object.setA_Wh_Comp(line[6]);
		object.setCI_Min_A_Wh_Comp(line[7]);
		object.setCI_Max_A_Wh_Comp(line[8]);
		object.setA_Bl_Comp(line[9]);
		object.setCI_Min_A_Bl_Comp(line[10]);
		object.setCI_Max_A_Bl_Comp(line[11]);
		object.setA_Ot_Comp(line[12]);
		object.setCI_Min_A_Ot_Comp(line[13]);
		object.setCI_Max_A_Ot_Comp(line[14]);
		object.setA_Hi_Comp(line[15]);
		object.setCI_Min_A_Hi_Comp(line[16]);
		object.setCI_Max_A_Hi_Comp(line[17]);
		object.setA_Wh_BirthDef(line[18]);
		object.setCI_Min_A_Wh_BirthDef(line[19]);
		object.setCI_Max_A_Wh_BirthDef(line[20]);
		object.setA_Bl_BirthDef(line[21]);
		object.setCI_Min_A_Bl_BirthDef(line[22]);
		object.setCI_Max_A_Bl_BirthDef(line[23]);
		object.setA_Ot_BirthDef(line[24]);
		object.setCI_Min_A_Ot_BirthDef(line[25]);
		object.setCI_Max_A_Ot_BirthDef(line[26]);
		object.setA_Hi_BirthDef(line[27]);
		object.setCI_Min_A_Hi_BirthDef(line[28]);
		object.setCI_Max_A_Hi_BirthDef(line[29]);
		object.setB_Wh_Injury(line[30]);
		object.setCI_Min_B_Wh_Injury(line[31]);
		object.setCI_Max_B_Wh_Injury(line[32]);
		object.setB_Bl_Injury(line[33]);
		object.setCI_Min_B_Bl_Injury(line[34]);
		object.setCI_Max_B_Bl_Injury(line[35]);
		object.setB_Ot_Injury(line[36]);
		object.setCI_Min_B_Ot_Injury(line[37]);
		object.setCI_Max_B_Ot_Injury(line[38]);
		object.setB_Hi_Injury(line[39]);
		object.setCI_Min_B_Hi_Injury(line[40]);
		object.setCI_Max_B_Hi_Injury(line[41]);
		object.setB_Wh_Cancer(line[42]);
		object.setCI_Min_B_Wh_Cancer(line[43]);
		object.setCI_Max_B_Wh_Cancer(line[44]);
		object.setB_Bl_Cancer(line[45]);
		object.setCI_Min_B_Bl_Cancer(line[46]);
		object.setCI_Max_B_Bl_Cancer(line[47]);
		object.setB_Ot_Cancer(line[48]);
		object.setCI_Min_B_Ot_Cancer(line[49]);
		object.setCI_Max_B_Ot_Cancer(line[50]);
		object.setB_Hi_Cancer(line[51]);
		object.setCI_Min_B_Hi_Cancer(line[52]);
		object.setCI_Max_B_Hi_Cancer(line[53]);
		object.setB_Wh_Homicide(line[54]);
		object.setCI_Min_B_Wh_Homicide(line[55]);
		object.setCI_Max_B_Wh_Homicide(line[56]);
		object.setB_Bl_Homicide(line[57]);
		object.setCI_Min_B_Bl_Homicide(line[58]);
		object.setCI_Max_B_Bl_Homicide(line[59]);
		object.setB_Ot_Homicide(line[60]);
		object.setCI_Min_B_Ot_Homicide(line[61]);
		object.setCI_Max_B_Ot_Homicide(line[62]);
		object.setB_Hi_Homicide(line[63]);
		object.setCI_Min_B_Hi_Homicide(line[64]);
		object.setCI_Max_B_Hi_Homicide(line[65]);
		object.setC_Wh_Injury(line[66]);
		object.setCI_Min_C_Wh_Injury(line[67]);
		object.setCI_Max_C_Wh_Injury(line[68]);
		object.setC_Bl_Injury(line[69]);
		object.setCI_Min_C_Bl_Injury(line[70]);
		object.setCI_Max_C_Bl_Injury(line[71]);
		object.setC_Ot_Injury(line[72]);
		object.setCI_Min_C_Ot_Injury(line[73]);
		object.setCI_Max_C_Ot_Injury(line[74]);
		object.setC_Hi_Injury(line[75]);
		object.setCI_Min_C_Hi_Injury(line[76]);
		object.setCI_Max_C_Hi_Injury(line[77]);
		object.setC_Wh_Homicide(line[78]);
		object.setCI_Min_C_Wh_Homicide(line[79]);
		object.setCI_Max_C_Wh_Homicide(line[80]);
		object.setC_Bl_Homicide(line[81]);
		object.setCI_Min_C_Bl_Homicide(line[82]);
		object.setCI_Max_C_Bl_Homicide(line[83]);
		object.setC_Ot_homicide(line[84]);
		object.setCI_Min_C_Ot_homicide(line[85]);
		object.setCI_Max_C_Ot_homicide(line[86]);
		object.setC_Hi_Homicide(line[87]);
		object.setCI_Min_C_Hi_Homicide(line[88]);
		object.setCI_Max_C_Hi_Homicide(line[89]);
		object.setC_Wh_Suicide(line[90]);
		object.setCI_Min_C_Wh_Suicide(line[91]);
		object.setCI_Max_C_Wh_Suicide(line[92]);
		object.setC_Bl_Suicide(line[93]);
		object.setCI_Min_C_Bl_Suicide(line[94]);
		object.setCI_Max_C_Bl_Suicide(line[95]);
		object.setC_Ot_Suicide(line[96]);
		object.setCI_Min_C_Ot_Suicide(line[97]);
		object.setCI_Max_C_Ot_Suicide(line[98]);
		object.setC_Hi_Suicide(line[99]);
		object.setCI_Min_C_Hi_Suicide(line[100]);
		object.setCI_Max_C_Hi_Suicide(line[101]);
		object.setC_Wh_Cancer(line[102]);
		object.setCI_Min_C_Wh_Cancer(line[103]);
		object.setCI_Max_C_Wh_Cancer(line[104]);
		object.setC_Bl_Cancer(line[105]);
		object.setCI_Min_C_Bl_Cancer(line[106]);
		object.setCI_Max_C_Bl_Cancer(line[107]);
		object.setC_Ot_Cancer(line[108]);
		object.setCI_Min_C_Ot_Cancer(line[109]);
		object.setCI_Max_C_Ot_Cancer(line[110]);
		object.setC_Hi_Cancer(line[111]);
		object.setCI_Min_C_Hi_Cancer(line[112]);
		object.setCI_Max_C_Hi_Cancer(line[113]);
		object.setD_Wh_Injury(line[114]);
		object.setCI_Min_D_Wh_Injury(line[115]);
		object.setCI_Max_D_Wh_Injury(line[116]);
		object.setD_Bl_Injury(line[117]);
		object.setCI_Min_D_Bl_Injury(line[118]);
		object.setCI_Max_D_Bl_Injury(line[119]);
		object.setD_Ot_Injury(line[120]);
		object.setCI_Min_D_Ot_Injury(line[121]);
		object.setCI_Max_D_Ot_Injury(line[122]);
		object.setD_Hi_Injury(line[123]);
		object.setCI_Min_D_Hi_Injury(line[124]);
		object.setCI_Max_D_Hi_Injury(line[125]);
		object.setD_Wh_Cancer(line[126]);
		object.setCI_Min_D_Wh_Cancer(line[127]);
		object.setCI_Max_D_Wh_Cancer(line[128]);
		object.setD_Bl_Cancer(line[129]);
		object.setCI_Min_D_Bl_Cancer(line[130]);
		object.setCI_Max_D_Bl_Cancer(line[131]);
		object.setD_Ot_Cancer(line[132]);
		object.setCI_Min_D_Ot_Cancer(line[133]);
		object.setCI_Max_D_Ot_Cancer(line[134]);
		object.setD_Hi_Cancer(line[135]);
		object.setCI_Min_D_Hi_Cancer(line[136]);
		object.setCI_Max_D_Hi_Cancer(line[137]);
		object.setD_Wh_HeartDis(line[138]);
		object.setCI_Min_D_Wh_HeartDis(line[139]);
		object.setCI_Max_D_Wh_HeartDis(line[140]);
		object.setD_Bl_HeartDis(line[141]);
		object.setCI_Min_D_Bl_HeartDis(line[142]);
		object.setCI_Max_D_Bl_HeartDis(line[143]);
		object.setD_Ot_HeartDis(line[144]);
		object.setCI_Min_D_Ot_HeartDis(line[145]);
		object.setCI_Max_D_Ot_HeartDis(line[146]);
		object.setD_Hi_HeartDis(line[147]);
		object.setCI_Min_D_Hi_HeartDis(line[148]);
		object.setCI_Max_D_Hi_HeartDis(line[149]);
		object.setD_Wh_Suicide(line[150]);
		object.setCI_Min_D_Wh_Suicide(line[151]);
		object.setCI_Max_D_Wh_Suicide(line[152]);
		object.setD_Bl_Suicide(line[153]);
		object.setCI_Min_D_Bl_Suicide(line[154]);
		object.setCI_Max_D_Bl_Suicide(line[155]);
		object.setD_Ot_Suicide(line[156]);
		object.setCI_Min_D_Ot_Suicide(line[157]);
		object.setCI_Max_D_Ot_Suicide(line[158]);
		object.setD_Hi_Suicide(line[159]);
		object.setCI_Min_D_Hi_Suicide(line[160]);
		object.setCI_Max_D_Hi_Suicide(line[161]);
		object.setD_Wh_HIV(line[162]);
		object.setCI_Min_D_Wh_HIV(line[163]);
		object.setCI_Max_D_Wh_HIV(line[164]);
		object.setD_Bl_HIV(line[165]);
		object.setCI_Min_D_Bl_HIV(line[166]);
		object.setCI_Max_D_Bl_HIV(line[167]);
		object.setD_Ot_HIV(line[168]);
		object.setCI_Min_D_Ot_HIV(line[169]);
		object.setCI_Max_D_Ot_HIV(line[170]);
		object.setD_Hi_HIV(line[171]);
		object.setCI_Min_D_Hi_HIV(line[172]);
		object.setCI_Max_D_Hi_HIV(line[173]);
		object.setD_Wh_Homicide(line[174]);
		object.setCI_Min_D_Wh_Homicide(line[175]);
		object.setCI_Max_D_Wh_Homicide(line[176]);
		object.setD_Bl_Homicide(line[177]);
		object.setCI_Min_D_Bl_Homicide(line[178]);
		object.setCI_Max_D_Bl_Homicide(line[179]);
		object.setD_Ot_Homicide(line[180]);
		object.setCI_Min_D_Ot_Homicide(line[181]);
		object.setCI_Max_D_Ot_Homicide(line[182]);
		object.setD_Hi_Homicide(line[183]);
		object.setCI_Min_D_Hi_Homicide(line[184]);
		object.setCI_Max_D_Hi_Homicide(line[185]);
		object.setE_Wh_Cancer(line[186]);
		object.setCI_Min_E_Wh_Cancer(line[187]);
		object.setCI_Max_E_Wh_Cancer(line[188]);
		object.setE_Bl_Cancer(line[189]);
		object.setCI_Min_E_Bl_Cancer(line[190]);
		object.setCI_Max_E_Bl_Cancer(line[191]);
		object.setE_Ot_Cancer(line[192]);
		object.setCI_Min_E_Ot_Cancer(line[193]);
		object.setCI_Max_E_Ot_Cancer(line[194]);
		object.setE_Hi_Cancer(line[195]);
		object.setCI_Min_E_Hi_Cancer(line[196]);
		object.setCI_Max_E_Hi_Cancer(line[197]);
		object.setE_Wh_HeartDis(line[198]);
		object.setCI_Min_E_Wh_HeartDis(line[199]);
		object.setCI_Max_E_Wh_HeartDis(line[200]);
		object.setE_Bl_HeartDis(line[201]);
		object.setCI_Min_E_Bl_HeartDis(line[202]);
		object.setCI_Max_E_Bl_HeartDis(line[203]);
		object.setE_Ot_HeartDis(line[204]);
		object.setCI_Min_E_Ot_HeartDis(line[205]);
		object.setCI_Max_E_Ot_HeartDis(line[206]);
		object.setE_Hi_HeartDis(line[207]);
		object.setCI_Min_E_Hi_HeartDis(line[208]);
		object.setCI_Max_E_Hi_HeartDis(line[209]);
		object.setF_Wh_HeartDis(line[210]);
		object.setCI_Min_F_Wh_HeartDis(line[211]);
		object.setCI_Max_F_Wh_HeartDis(line[212]);
		object.setF_Bl_HeartDis(line[213]);
		object.setCI_Min_F_Bl_HeartDis(line[214]);
		object.setCI_Max_F_Bl_HeartDis(line[215]);
		object.setF_Ot_HeartDis(line[216]);
		object.setCI_Min_F_Ot_HeartDis(line[217]);
		object.setCI_Max_F_Ot_HeartDis(line[218]);
		object.setF_Hi_HeartDis(line[219]);
		object.setCI_Min_F_Hi_HeartDis(line[220]);
		object.setCI_Max_F_Hi_HeartDis(line[221]);
		object.setF_Wh_Cancer(line[222]);
		object.setCI_Min_F_Wh_Cancer(line[223]);
		object.setCI_Max_F_Wh_Cancer(line[224]);
		object.setF_Bl_Cancer(line[225]);
		object.setCI_Min_F_Bl_Cancer(line[226]);
		object.setCI_Max_F_Bl_Cancer(line[227]);
		object.setF_Ot_Cancer(line[228]);
		object.setCI_Min_F_Ot_Cancer(line[229]);
		object.setCI_Max_F_Ot_Cancer(line[230]);
		object.setF_Hi_Cancer(line[231]);
		object.setCI_Min_F_Hi_Cancer(line[232]);
		object.setCI_Max_F_Hi_Cancer(line[233]);
		object.setLCD_Time_Span(line[234]);
		return object;
	}

}
